﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace VisionCloud.Core.Model.Ms
{
    [Table("TaskPoints")]
    public class TaskPoints : BaseEntity
    {
        public enum PointStatus
        {
            开始测量 = 0,
            采集中 = 1,
            采集完成 = 4,
            计算中 = 2,
            计算完成 = 5,
            测量完成 = 3,
            进行中 = 10,
            开始合并 = 20,
            合并完成 = 30,
        }

        public enum RateStatus
        {
            高 = 1,
            低 = 0,
        }

        [Key]
        [Column(TypeName = "uuid")]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public Guid pointId { get; set; }

        [Column(TypeName = "uuid")]
        [Required]
        public Guid TaskId { get; set; }

        [Column(TypeName = "int4")]
        public int pintIndex { get; set; }

        [Column(TypeName = "varchar(64)")]
        public string x { get; set; }

        [Column(TypeName = "varchar(64)")]
        public string y { get; set; }

        [Column(TypeName = "varchar(64)")]
        public string offsetX { get; set; }

        [Column(TypeName = "varchar(64)")]
        public string offsetY { get; set; }

        [Column(TypeName = "int4")]
        [Required]
        public RateStatus rate { get; set; }

        [Column(TypeName = "int4")]
        [Required]
        public PointStatus status { get; set; }

        [Column(TypeName = "varchar(2000)")]
        public string filePath { get; set; }

        [Column(TypeName = "varchar(2000)")]
        public string ErrorMessage { get; set; }

        /// <summary>
        /// 站点类型UUID,站点类型：1:客厅 2:卧室 3:厨房 4:洗手间 5:阳台
        /// </summary>
        [Column(TypeName = "uuid")]
        [DatabaseGenerated(DatabaseGeneratedOption.None)]
        public Guid MsPointTypeId { get; set; }

        /// <summary>
        /// 站点测量项：人工和机器
        /// </summary>
        [Column(TypeName = "text")]
        public string UseStandards { get; set; }

        /// <summary>
        /// 是否输入了人工测量项
        /// </summary>
        [Column(TypeName = "boolean")]
        public bool IsManualMeasureInput { get; set; }

        [Column(TypeName = "text")]
        public string PictureJson { get; set; }

        [Column(TypeName = "varchar(255)")]
        public string HouseTypeName { get; set; }

        [Column(TypeName = "int4")]
        public int? HouseTypeKey { get; set; }

        /// <summary>
        /// 子站点信息列表
        /// </summary>
        [Column(TypeName = "text")]
        public string SubPointList { get; set; }

        [ForeignKey("PointId")]
        public virtual ICollection<MSTaskPoint2ManualMeasurement> MeasureItems { get; set; }
    }
}